import java.util.StringTokenizer;

public class Test14 {
    public static void main(String[] args) {
        String str = "Hello world, welcome to Java programming!";
        
        StringTokenizer tokenizer = new StringTokenizer(str);
        int count = tokenizer.countTokens();
        
        System.out.println("单词数: " + count);
    }
}